package main

import (
	"net/http"

	"github.com/julienschmidt/httprouter"
)

func RegisterHandler() *httprouter.Router {
	router := httprouter.New()
	router.GET("/", homeHandler) // 主页
	router.POST("/", homeHandler)
	router.GET("/userhome", userHomeHandler)  // 用户主页
	router.POST("/userhome", userHomeHandler) // 用户主页
	router.POST("/api", apiHandler)           // api
	/* 代理的相关处理 */
	router.POST("/upload/:vid-id", proxyHandler)
	// 模板和内部静态资源
	router.ServeFiles("/statics/*filepath", http.Dir("./templates"))
	return router
}
func main() {
	r := RegisterHandler()
	http.ListenAndServe(":8080", r)
}
